package application;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class Manager {
	private String loadedFilePath;

	private static Manager instance = null;

	public synchronized static Manager getInstance() {
		if (instance == null) {
			instance = new Manager();
		}
		return instance;
	}

	public void loadFile(String path) {
		this.loadedFilePath = path;

		try {
			FileReader fr = new FileReader(loadedFilePath);
			BufferedReader br = new BufferedReader(fr);
			String line;
			while ((line = br.readLine()) != null && !line.isEmpty()) {
				System.out.println(line);
			}
			br.close();
			fr.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public String getLoadedFilePath() {
		return loadedFilePath;
	}

}
